public class Test {
    public static int fun(int n){
        if(n<10){
            return n;
        }else{
            return n % 10 + fun(n /10);
        }
    }
    public static void main(String[] args) {
        System.out.println(fun(1235));
    }
}
